package com.hehua.SimpleFactoryTwo;

import org.w3c.dom.Document;
import org.w3c.dom.NodeList;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;

/**
 * 测试用例
 */
public class ChartClient {
    public static void main(String[] args) throws Exception {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc;
        doc = builder.parse(new File("src//com//hehua//SimpleFactoryTwo//Chart.xml"));
        NodeList tagName = doc.getElementsByTagName("chartType");
        String nodeValue = tagName.item(0).getFirstChild().getNodeValue();
        Chart chart = ChartFactory.createChart(nodeValue);
        System.out.println(chart);
    }
}
